//
//  ItemButtonView.m
//  ProjectforHDX
//
//  Created by HDX on 16/8/2.
//  Copyright © 2016年 H.DX. All rights reserved.
//

#import "ItemButtonView.h"

@implementation ItemButtonView


-(id)initItemFrame:(CGRect)frame icon:(UIImage*)icon title:(NSString*)title value:(NSString*)value{
    self=[super initWithFrame:frame];
    if(self){
        
        RZCustomButtom *submit=[[RZCustomButtom alloc] init];
        submit.userInteractionEnabled=NO;
        [submit setFrame:CGRectMake(3,0,self.width-3,25)];
        submit.titleLabel.numberOfLines = 0;
        [submit setTitle:title forState:UIControlStateNormal];//确认
        [submit setImage:icon forState:UIControlStateNormal];
        [submit setTitleColor:[UtilCheck hexStringToColor:@"9ea7ad" alpha:1]  forState:UIControlStateNormal];
        
        CGFloat width = [Toolobject widthForString:title height:25 fontSize:15];
        if (width > (self.width - 5)) {
            [submit.titleLabel setFont:CustomFont(12)];
        }
        else {
            [submit.titleLabel setFont:CustomFont(14)];
        }
        [self addSubview:submit];
        
        RZCustomLable *labTitle=[[RZCustomLable alloc] init];
        labTitle.userInteractionEnabled=NO;
        [labTitle setFrame:CGRectMake(5, 0, self.width - 10, 25)];
        labTitle.numberOfLines=1;
        labTitle.textAlignment=NSTextAlignmentCenter;
        labTitle.text=[NSString stringWithFormat:@"%@",value];
        labTitle.font=CustomFont(25);
        [labTitle setTextColor:[UtilCheck hexStringToColor:@"48555e" alpha:1]];
        [self addSubview:labTitle];
        submit.top=(self.height-submit.height-labTitle.height)/2.f;
        labTitle.top=submit.bottom + 10;
        self.labValue=labTitle;
       
    }
    return self;
}



@end
